<?xml version="1.0" encoding="iso-8859-1"?>

<!-- 
  -- Please see the readme.txt file included with this distribution for 
  -- attribution and copyright information.
  -->

<root version="2.0">
	<windowclass name="charsheetmini_powerabilityitem">
		<sizelimits>
			<minimum>
				<height>0</height>
			</minimum>
		</sizelimits>
		<script file="scripts/charsheetmini_powerabilityitem.lua" />
		<sheetdata>
			<!-- TYPE -->
			<iconcycler name="type">
				<anchored>
					<top>
						<anchor>top</anchor>
					</top>
					<left>
						<anchor>left</anchor>
					</left>
					<size>
						<height>16</height>
						<width>18</width>
					</size>
				</anchored>
				<parameters>
					<defaulticon>indicator_question</defaulticon>
					<icons>indicator_sword|indicator_heal|indicator_effect</icons>
					<values>attack|heal|effect</values>
					<tooltips>Attack|Heal|Effect</tooltips>
				</parameters>
				<readonly />
			</iconcycler>

			<!-- FRAME -->
			<genericcontrol>
				<anchored>
					<top>
						<anchor>top</anchor>
					</top>
					<left>
						<parent>type</parent>
						<anchor>right</anchor>
						<offset>5</offset>
					</left>
					<right>
						<anchor>right</anchor>
						<offset>-5</offset>
					</right>
					<size>
						<height>16</height>
					</size>
				</anchored>
				<frame>
					<name>modifier</name>
					<offset>6,4,6,2</offset>
				</frame>
				<script>
					function onHover(bOnControl)
						window.highlight(bOnControl);
					end
				</script>
			</genericcontrol>

			<!-- ATTACK/DAMAGE -->
			<stringcontrol name="focuslabel">
				<anchored>
					<top>
						<anchor>top</anchor>
					</top>
					<left>
						<parent>type</parent>
						<relation>relative</relation>
						<anchor>right</anchor>
						<offset>5</offset>
					</left>
				</anchored>
				<font>sheettextblock</font>
				<static>Foc:</static>
				<script>
					function onHover(bOnControl)
						window.highlight(bOnControl);
					end
				</script>
			</stringcontrol>
			<jpgnumberfield name="focus">
				<anchored>
					<top>
						<anchor>top</anchor>
					</top>
					<left>
						<parent>type</parent>
						<relation>relative</relation>
						<anchor>right</anchor>
						<offset>2</offset>
					</left>
					<size>
						<height>16</height>
						<width>10</width>
					</size>
				</anchored>
				<font>sheettextblock</font>
				<readonly />
				<script>
					function onHover(bOnControl)
						window.highlight(bOnControl);
					end
				</script>
			</jpgnumberfield>
			<stringcontrol name="attacklabel">
				<anchored>
					<top>
						<anchor>top</anchor>
					</top>
					<left>
						<parent>type</parent>
						<relation>relative</relation>
						<anchor>right</anchor>
						<offset>5</offset>
					</left>
				</anchored>
				<font>sheettextblock</font>
				<static>Atk:</static>
				<script>
					function onInit()
						setHoverCursor("hand");
					end

					function onHover(bOnControl)
						window.highlight(bOnControl);
					end

					function onDrag(button, x, y, draginfo)
						if dragging then
							return true;
						end

						dragging = CharSheetCommon.onDragPowerAbility(window.getDatabaseNode(), draginfo, "attack");

						return true;
					end

					function onDragEnd(draginfo)
						dragging = false;
					end

					function onDoubleClick(x, y)
						CharSheetCommon.onDoubleClickPowerAbility(window.getDatabaseNode(), "attack");
						return true;
					end
				</script>
			</stringcontrol>
			<genericcontrol name="attackicon">
				<anchored>
					<top>
						<anchor>top</anchor>
					</top>
					<left>
						<parent>type</parent>
						<relation>relative</relation>
						<anchor>right</anchor>
						<offset>2</offset>
					</left>
					<size>
						<height>16</height>
						<width>18</width>
					</size>
				</anchored>
				<icon>d20icon</icon>
				<script>
					function onInit()
						setHoverCursor("hand");
					end

					function onHover(bOnControl)
						window.highlight(bOnControl);
					end

					function onDrag(button, x, y, draginfo)
						if dragging then
							return true;
						end

						dragging = CharSheetCommon.onDragPowerAbility(window.getDatabaseNode(), draginfo, "attack");

						return true;
					end

					function onDragEnd(draginfo)
						dragging = false;
					end

					function onDoubleClick(x, y)
						CharSheetCommon.onDoubleClickPowerAbility(window.getDatabaseNode(), "attack");
						return true;
					end
				</script>
			</genericcontrol>
			<stringcontrol name="damagelabel">
				<anchored>
					<top>
						<anchor>top</anchor>
					</top>
					<left>
						<parent>type</parent>
						<relation>relative</relation>
						<anchor>right</anchor>
						<offset>5</offset>
					</left>
				</anchored>
				<font>sheettextblock</font>
				<static>Dmg:</static>
				<script>
					function onInit()
						setHoverCursor("hand");
					end

					function onHover(bOnControl)
						window.highlight(bOnControl);
					end

					function onDrag(button, x, y, draginfo)
						if dragging then
							return true;
						end

						dragging = CharSheetCommon.onDragPowerAbility(window.getDatabaseNode(), draginfo, "damage");

						return true;
					end

					function onDragEnd(draginfo)
						dragging = false;
					end

					function onDoubleClick(x, y)
						CharSheetCommon.onDoubleClickPowerAbility(window.getDatabaseNode(), "damage");
						return true;
					end
				</script>
			</stringcontrol>
			<genericcontrol name="damageicon">
				<anchored>
					<top>
						<anchor>top</anchor>
					</top>
					<left>
						<parent>type</parent>
						<relation>relative</relation>
						<anchor>right</anchor>
						<offset>2</offset>
					</left>
					<size>
						<height>16</height>
						<width>18</width>
					</size>
				</anchored>
				<icon>d20icon</icon>
				<script>
					function onInit()
						setHoverCursor("hand");
					end

					function onHover(bOnControl)
						window.highlight(bOnControl);
					end

					function onDrag(button, x, y, draginfo)
						if dragging then
							return true;
						end

						dragging = CharSheetCommon.onDragPowerAbility(window.getDatabaseNode(), draginfo, "damage");

						return true;
					end

					function onDragEnd(draginfo)
						dragging = false;
					end

					function onDoubleClick(x, y)
						CharSheetCommon.onDoubleClickPowerAbility(window.getDatabaseNode(), "damage");
						return true;
					end
				</script>
			</genericcontrol>


			<!-- HEAL -->
			<stringcontrol name="heallabel">
				<anchored>
					<top>
						<anchor>top</anchor>
					</top>
					<left>
						<parent>type</parent>
						<anchor>right</anchor>
						<offset>5</offset>
					</left>
					<size>
						<width>25</width>
					</size>
				</anchored>
				<font>sheettextblock</font>
				<static>Heal:</static>
				<script>
					function onInit()
						setHoverCursor("hand");
					end

					function onHover(bOnControl)
						window.highlight(bOnControl);
					end

					function onDrag(button, x, y, draginfo)
						if dragging then
							return true;
						end

						dragging = CharSheetCommon.onDragPowerAbility(window.getDatabaseNode(), draginfo);

						return true;
					end

					function onDragEnd(draginfo)
						dragging = false;
					end

					function onDoubleClick(x, y)
						CharSheetCommon.onDoubleClickPowerAbility(window.getDatabaseNode());
						return true;
					end
				</script>
			</stringcontrol>
			<genericcontrol name="healicon">
				<anchored>
					<top>
						<anchor>top</anchor>
					</top>
					<left>
						<parent>heallabel</parent>
						<anchor>right</anchor>
						<offset>2</offset>
					</left>
					<size>
						<height>16</height>
						<width>18</width>
					</size>
				</anchored>
				<icon>d20icon</icon>
				<script>
					function onInit()
						setHoverCursor("hand");
					end

					function onHover(bOnControl)
						window.highlight(bOnControl);
					end

					function onDrag(button, x, y, draginfo)
						if dragging then
							return true;
						end

						dragging = CharSheetCommon.onDragPowerAbility(window.getDatabaseNode(), draginfo);

						return true;
					end

					function onDragEnd(draginfo)
						dragging = false;
					end

					function onDoubleClick(x, y)
						CharSheetCommon.onDoubleClickPowerAbility(window.getDatabaseNode());
						return true;
					end
				</script>
			</genericcontrol>


			<!-- EFFECT -->
			<stringfield name="label">
				<bounds>0,0,1,1</bounds>
				<invisible/>
				<script>
					function onValueChanged()
						window.effectview.onEffectChanged();
					end
				</script>
			</stringfield>
			<stringfield name="apply">
				<bounds>0,0,1,1</bounds>
				<invisible/>
				<script>
					function onValueChanged()
						window.effectview.onEffectChanged();
					end
				</script>
			</stringfield>
			<stringfield name="targeting">
				<bounds>0,0,1,1</bounds>
				<invisible/>
				<script>
					function onValueChanged()
						window.effectview.onEffectChanged();
					end
				</script>
			</stringfield>
			<stringcontrol name="effectview">
				<anchored>
					<top>
						<anchor>top</anchor>
					</top>
					<left>
						<parent>type</parent>
						<anchor>right</anchor>
						<offset>5</offset>
					</left>
					<right>
						<anchor>right</anchor>
						<offset>-5</offset>
					</right>
					<size>
						<height>16</height>
					</size>
				</anchored>
				<font>sheettextblock</font>
				<script>
					function onInit()
						setReadOnly(true);
						setHoverCursor("hand");
						onEffectChanged();
					end

					function onHover(bOnControl)
						window.highlight(bOnControl);
					end

					function onDrag(button, x, y, draginfo)
						if dragging then
							return true;
						end

						dragging = CharSheetCommon.onDragPowerAbility(window.getDatabaseNode(), draginfo);

						return true;
					end

					function onDragEnd(draginfo)
						dragging = false;
					end

					function onDoubleClick(x, y)
						CharSheetCommon.onDoubleClickPowerAbility(window.getDatabaseNode());
						return true;
					end
					
					function onEffectChanged()
						local sLabel = window.label.getValue();

						local sApply = window.apply.getValue();
						if sApply == "once" then
							sLabel = "ONCE; " .. sLabel;
						elseif sApply == "single" then
							sLabel = "SINGLE; " .. sLabel;
						end

						local sTargeting = window.targeting.getValue();
						if sTargeting == "self" then
							sLabel = "SELF; " .. sLabel;
						end
						
						setValue(sLabel);
					end
				</script>
			</stringcontrol>
		</sheetdata>
	</windowclass>
	
	<windowclass name="charsheetmini_powerlistitem">
		<sizelimits>
			<minimum>
				<height>16</height>
			</minimum>
		</sizelimits>
		<script file="scripts/charsheetmini_powerlistitem.lua" />
		<sheetdata>
			<stringfield name="keywords">
				<bounds>0,0,1,1</bounds>
				<invisible />
				<script>
					function onValueChanged()
						window.abilities.applyFilter();
					end
				</script>
			</stringfield>
			<stringfield name="recharge">
				<bounds>0,0,1,1</bounds>
				<invisible />
				<script>
					function onValueChanged()
						window.name.updateColor();
					end
				</script>
			</stringfield>

			<checkcounter name="usedcounter">
				<anchored>
					<left>
						<anchor>left</anchor>
						<offset>1</offset>
					</left>
					<top>
						<anchor>top</anchor>
						<offset>2</offset>
					</top>
					<size>
						<height>12</height>
						<width>10</width>
					</size>
				</anchored>
				<sourcefields>
					<maximum>prepared</maximum>
					<current>used</current>
				</sourcefields>
				<script>
					function onValueChanged()
						window.windowlist.window.onPowerClick();
					end
					
					function onClickRelease(button, x, y)
						local n = getValue();
						local answer = super.onClickRelease(button, x, y);
						if getValue() > n then
							window.activatePower(false);
						end
						return answer;
					end
				</script>
			</checkcounter>
			<genericcontrol name="useatwill">
				<anchored>
					<left>
						<anchor>left</anchor>
						<offset>1</offset>
					</left>
					<top>
						<anchor>top</anchor>
						<offset>2</offset>
					</top>
					<size>
						<height>12</height>
						<width>12</width>
					</size>
				</anchored>
				<icon>indicator_casterspontaneous</icon>
				<script>
					function onClickDown(button, x, y)
						return true;
					end

					function onClickRelease(button, x, y)
						window.activatePower(false);
						return true;
					end
				</script>
			</genericcontrol>

			<windowreferencefield name="shortcut">
				<anchored>
					<left>
						<anchor>left</anchor>
						<offset>14</offset>
					</left>
					<top>
						<anchor>top</anchor>
						<offset>0</offset>
					</top>
					<size>
						<width>14</width>
						<height>14</height>
					</size>
				</anchored>
				<icon>
					<normal>button_openwindow</normal>
					<empty>button_emptytarget</empty>
					<pressed>button_emptytarget</pressed>
				</icon>
			</windowreferencefield>
			
			<stringfield name="action">
				<anchored>
					<top>
						<anchor>top</anchor>
						<offset>0</offset>
					</top>
					<right>
						<anchor>right</anchor>
						<offset>-5</offset>
					</right>
					<size>
						<width>50</width>
					</size>
				</anchored>
				<font>sheettextblock</font>
				<static />
			</stringfield>
			
			<windowlist name="abilities">
				<anchored>
					<top>
						<anchor>top</anchor>
					</top>
					<right>
						<anchor>right</anchor>
						<offset>-60</offset>
					</right>
					<size>
						<width>165</width>
					</size>
				</anchored>
				<skipempty />
				<datasource>.abilities</datasource>
				<class>charsheetmini_powerabilityitem</class>
				<noscroll />
				<script>
					function onFilter(w)
						return w.onFilter();
					end
				</script>
			</windowlist>

			<stringfield name="name">
				<anchored>
					<left>
						<parent>shortcut</parent>
						<anchor>right</anchor>
						<offset>7</offset>
					</left>
					<top>
						<anchor>top</anchor>
						<offset>1</offset>
					</top>
					<right>
						<anchor>right</anchor>
						<offset>-232</offset>
					</right>
				</anchored>
				<font>statblock-r-med</font>
				<static />
				<script>
					function onInit()
						updateColor();
					end

					function updateColor()
						local rechargestr = string.lower(string.sub(window.recharge.getValue(),1,2));
						if rechargestr == "da" then
							window.name.setColor("ffffffff");
							window.name.setFrame("dailyframe", 3, 0, 6, 1)
						elseif rechargestr == "en" then
							window.name.setColor("ffffffff");
							window.name.setFrame("encounterframe", 3, 0, 6, 1)
						elseif rechargestr == "at" then
							window.name.setColor("ffffffff");
							window.name.setFrame("atwillframe", 3, 0, 6, 1)
						else
							window.name.setColor("ff000000");
							window.name.setFrame("tempmodmini", 3, 1, 6, 3)
						end
					end
					
					function onDoubleClick(x,y)
						window.activatePower(true);
					end
				</script>
			</stringfield>
			
			<spacercontrol>
				<anchor>name</anchor>
				<height>2</height>
			</spacercontrol>
		</sheetdata>
	</windowclass>

	<windowclass name="charsheetmini_powertype">
		<sizelimits>
			<minimum>
				<height>0</height>
			</minimum>
		</sizelimits>
		<script file="scripts/charsheetmini_powertype.lua" />
		<sheetdata>
			<!-- Hidden fields -->
			<numberfield name="usesavailable">
				<invisible />
				<bounds>0,0,1,1</bounds>
				<script>
					function onValueChanged()
						window.checkUseLimit();
					end
				</script>
			</numberfield>

			<stringcontrol name="label">
				<anchored>
					<left>
						<anchor>left</anchor>
					</left>
					<right>
						<anchor>right</anchor>
					</right>
					<top>
						<anchor>top</anchor>
						<offset>2</offset>
					</top>
				</anchored>
				<font>sheetlabelsmallbold</font>
				<empty>&#171; Power list &#187;</empty>
				<static />
				<frame>
					<name>rowshade</name>
				</frame>
				<script>
					function onClickDown(button, x, y)
						return true;
					end

					function onClickRelease(button, x, y)
						window.powerlist.setVisible(not window.powerlist.isVisible());
						return true;
					end
				</script>
			</stringcontrol>

			<windowlist name="powerlist">
				<anchored>
					<left>
						<anchor>left</anchor>
						<offset>0</offset>
					</left>
					<right>
						<anchor>right</anchor>
						<offset>0</offset>
					</right>
					<top>
						<parent>label</parent>
						<anchor>bottom</anchor>
						<offset>2</offset>
					</top>
				</anchored>
				<datasource>.power</datasource>
				<class>charsheetmini_powerlistitem</class>
				<noscroll />
				<script file="scripts/charsheetmini_powerlist.lua" />
			</windowlist>
		</sheetdata>
	</windowclass>

	<windowclass name="charsheetmini_powers">
		<placement>
			<size>
				<width>220</width>
				<height>200</height>
			</size>
		</placement>
		<nodelete />
		<sheetdata>
			<!-- POWERS -->
			<genericcontrol name="mini_powerframe">
				<bounds>0,10,-1,-15</bounds>
				<frame>
					<name>sheetgroup</name>
				</frame>
			</genericcontrol>

			<jpgnumberfield name="defaultweapon" source="powerfocus.weapon.order">
				<anchored>
					<to>mini_powerframe</to>
					<position>insidetopleft</position>
					<offset>100,9</offset>
					<size>
						<width>18</width>
						<height>16</height>
					</size>
				</anchored>
				<font>sheettextblock</font>
				<readonly />
				<hideonvalue value="0" />
			</jpgnumberfield>
			<stringcontrol>
				<anchored>
					<to>defaultweapon</to>
					<position>left</position>
					<offset>2,0</offset>
				</anchored>
				<font>sheettextblock</font>
				<static>Default Wpn:</static>
			</stringcontrol>
			
			<jpgnumberfield name="defaultimplement" source="powerfocus.implement.order">
				<anchored>
					<to>mini_powerframe</to>
					<position>insidetopright</position>
					<offset>30,9</offset>
					<size>
						<width>18</width>
						<height>16</height>
					</size>
				</anchored>
				<font>sheettextblock</font>
				<readonly />
				<hideonvalue value="0" />
			</jpgnumberfield>
			<stringcontrol>
				<anchored>
					<to>defaultimplement</to>
					<position>left</position>
					<offset>2,0</offset>
				</anchored>
				<font>sheettextblock</font>
				<static>Default Imp:</static>
			</stringcontrol>

			<windowlist name="powertypelist">
				<anchored>
					<to>mini_powerframe</to>
					<position>over</position>
					<offset>-12,-15</offset>
					<top>
						<parent>mini_powerframe</parent>
						<offset>25</offset>
					</top>
				</anchored>
				<datasource>.powers</datasource>
				<class>charsheetmini_powertype</class>
				<script file="scripts/charsheetmini_powertypelist.lua" />
			</windowlist>
			<scrollercontrol>
				<anchored>
					<to>powertypelist</to>
					<position>insidebottomright</position>
					<size>
						<width>45</width>
						<height>27</height>
					</size>
				</anchored>
				<target>powertypelist</target>
				<button>
					<normal>button_scroller</normal>
					<pressed>button_scroller_down</pressed>
				</button>
			</scrollercontrol>
		</sheetdata>
	</windowclass>
</root>
